package com.test.view;

import com.test.adapter.ImageAdapter;
import com.test.adapter.ImageListItemAdapter;
import com.test.demo.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;

/**
 * 喜爱
 * @author Harry
 *
 */
public class LikeActivity extends Activity implements OnItemClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		
		this.setContentView(R.layout.activity_like);
		
		addImageToGrid();
	}
	
	/**
	 * 添加图片
	 */
	private void addImageToGrid(){
		ListView listView = (ListView)this.findViewById(R.id.like_listView);
		
		ImageListItemAdapter adapter = new ImageListItemAdapter(this);
		if(listView != null){
			listView.setAdapter(adapter);
			listView.setOnItemClickListener(this);
		}
	}
	
	
	/**
	 * 点击图片回调
	 */
	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
			long arg3){
		
		Intent intent = new Intent();
		intent.setClass(LikeActivity.this, ImageInfoActivity.class);
		startActivity(intent);
		
	}

}
